const mongodb = require('../mongodb/index')
const goods = require('../mongodb/goods')

module.exports = function(){
    return (req,res)=>{
        const reg = new RegExp(`${req.query.searchStr}`)
        mongodb.get(goods,{keywords:reg},(data)=>{
            res.send(`
                jsonp_search_fn([${data}])
            `)
        },()=>{
            res.send(`
                console.log("错误的搜索,请查错")
            `)
        })
    }
}